import 'package:changxindianzishangwu/cache/local_cache.dart';
import 'package:changxindianzishangwu/http/base/ec_base_request.dart';
import 'package:changxindianzishangwu/http/request/dynamic_send_request.dart';
import 'package:changxindianzishangwu/http/zd_net.dart';
import 'package:changxindianzishangwu/model/dynamic_media_model.dart';
import 'package:changxindianzishangwu/pages/find/send_dynamic_page.dart';
import 'package:dio/dio.dart';
import 'package:wechat_assets_picker/wechat_assets_picker.dart';

class DynamicMediaDao {
  /**
   *发布朋友圈内容
   */
  static sendMediaContent(String text, int type, String key, String value,
      {String videoImage}) async {
    EcBaseRequest request = new DynamicSendRequest();
    request
        .add("text", text)
        .add("type", type)
        .add("access_token", getAppLoginToken())
        .add(key, value);
    if (type == MediaType.MEDIA_TEXT_VIDEO) {
      request.add("images", videoImage);
    }

    var result = await ZdNet.getInstance().send(request);
    var dy = DynamicMediaModel.fromJson(result);
    return dy.resultCode;
  }
}
